# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

_pyname=json-stream-rs-tokenizer
pkgname=python-${_pyname}
pkgver=0.4.22
pkgrel=2
pkgdesc='Faster tokenizer for the json-stream Python library'
arch=(loong64 x86_64)
url="https://github.com/smheidrich/py-json-stream-rs-tokenizer"
license=('MIT')
depends=('python')
makedepends=(
  python-build
  python-installer
  python-setuptools-rust
  python-wheel
)
source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
b2sums=('6946e653924716dfe6501ac3d2227122a2beb382354c838d1d335dc22568d7c594b5c008cf82d8d4f5caa95ab5c7e3a15f03b262de5b2097d9c9db0c30be4321')

build() {
  cd "${_pyname}-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd ${_pyname}-${pkgver}
  python -m installer --destdir=test_dir dist/*.whl

  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" python -c 'import json_stream_rs_tokenizer'
}

package() {
  cd "${_pyname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
